/**
  * @(#)Entry.java
  *
  * Application entry point and main initialization routine
  *
  * @author Course Scheduler Team
  * 
  * @license GNU General Public License version 3 (GPLv3)
  *
  * This file is part of Course Scheduler, an open source, cross platform
  * course scheduling tool, configurable for most universities.
  *
  * Copyright (C) 2010-2012 Course Scheduler Team
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  * 
  */
package com.pollicitus.scheduler.core;


/**
 * Application entry point and central initialization routine
 * 
 * @author Course Scheduler Team
 *
 */
public class Entry {
	
	//class constants
	private static final int NORMAL_TERMINATION = 0;
	private static final int UNHANDLED_EXCEPTION = 100;
	
	
	/**
	 * Application entry point. Basic initialization, execution,
	 * and cleanup is coordinated via this class. 
	 * 
	 * @param args Command line arguments to the application
	 */
	public static void main(String[] args){		
		try{
			Application.initialize(args);
			Application.execute();
			Application.finalize(args);
		}catch(Exception e2){
			e2.printStackTrace(System.err);
			System.err.println("\nUnhandled top level exception. Check the logs for more details.\n\nApplication terminating abnormally.");
			System.exit(UNHANDLED_EXCEPTION);
		}
		System.exit(NORMAL_TERMINATION);
	}
}
